package com.globant.google.mendoza.malbec;

import java.util.List;

import com.gargoylesoftware.htmlunit.KeyValuePair;
import com.globant.google.mendoza.malbec.schema._2.CheckoutShoppingCart;

/**
 * Generates the post variables needed to place an order.
 */
interface CartPostEncoder {

  /**
   * Returns a List of parameters containing the cart data to be posted.
   * @param cart The cart to be posted.
   * @param key The key used to sign the cart.
   * @return Returns a List of parameters containing the cart data to be posted.
   */
  List <KeyValuePair> generateParameters(final CheckoutShoppingCart cart,
      final String key);

  /**
   * Returns a List of parameters containing the cart data to be posted.
   * @param cart The cart to be posted.
   * @param key The key used to sign the cart.
   * @return Returns a List of parameters containing the cart data to be posted.
   */
  List <KeyValuePair> generateParameters(final String cart,
      final String key);

  /**
   * Returns the body to be sent in the request while posting the cart.
   * If the cart is sent as an encoded parameter, then it returns null.
   * @param cart the cart to post, as a String.
   * @return the body to be sent.
   */
  String getBodyForCart(final String cart);

  /**
   * Returns the body to be sent in the request while posting the cart.
   * If the cart is sent as an encoded parameter, then it returns null.
   * @param cart the cart to post, as a checkout shopping cart.
   * @return the body to be sent.
   */
  String getBodyForCart(final CheckoutShoppingCart cart);

}
